<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
Object obj=request.getSession().getAttribute("role_resource");
if(null==obj){
	response.setStatus(1000);
	return;
}
%> 
		<script type="text/javascript">
	var p1_store = new Ext.data.JsonStore( {
		root : "data",
		totalProperty : "total",
		fields : [ "period", "filename", "businpnt_no","businpnt_name","share","start_time",
		"end_time","card_id","card_name","paper_no","paper_name","state"],
		url : "work!xmlLogGridList.action"
	});
	//搜索条件外包商下拉列表
	var epiboly_store1=new Ext.data.JsonStore({
		root: "data",
   		fields : [ "id", "name"],
		url : "epiboly!listAll.action",
		listeners : {
			"load": function() {
				var RecordName = Ext.data.Record.create([
					{name: "id"},
					{name: "name"}
				]);
				var newRecord = new RecordName({
					id:"",
					name: "全部"
				});
				this.insert(0,newRecord);
			}
		}
	});
	//卡产品下拉列表
	var card_store = new Ext.data.JsonStore( {
		root: "data",
		fields : ["prodId","prodName"],
		url: "product!ProdName.action",
		listeners : {
			"load": function() {
				var RecordName = Ext.data.Record.create([
					{name: "prodId"},
					{name: "prodName"}
				]);
				var newRecord = new RecordName({
					prodId:"",
					prodName: "全部"
				});
				this.insert(0,newRecord);
			}
		}
	});
	//状态
	var state_store = new Ext.data.JsonStore( {
		fields : ["id","text"],
		data:[{id:"",text:"全部"},{id:"0",text:"失败"},{id:"1",text:"成功"},{id:"2",text:"生成中"}]
	});

	var sel = function(){
		p1_store.baseParams = p1_store.baseParams || {};
		p1_store.baseParams["xmldata.period"] = Ext.getCmp("a").getRawValue();
		p1_store.baseParams["xmldata.businpnt_no"] = Ext.getCmp("b").getValue();
		p1_store.baseParams["xmldata.card_id"] = Ext.getCmp("c").getValue();
		p1_store.baseParams["xmldata.state"] = Ext.getCmp("d").getValue();
		p1_store.load({params:{start:0,limit:limit}});
	};
	var xml_pel = new Ext.Panel( {
		id:"panel",
		border : false, 
		layout: "card",
		activeItem:0,
		items:[{
			id:"p1",
			xtype:"grid",
			store:p1_store,
			border : false, 
			headersDisabled: true,
			autoExpandColumn:"3",//自动填充的列
			columns:[
				new Ext.grid.RowNumberer( {header : "序号",width : 35}), 
			    {dataIndex : "period",		header : "期别", menuDisabled: true},
			    {dataIndex : "share",		header : "账单份数", menuDisabled: true},
			    {dataIndex : "filename",	header : "文件名称", menuDisabled: true},
			    {dataIndex : "businpnt_name",header : "外包商名称", menuDisabled: true},
			    {dataIndex : "card_name", 	header : "卡产品名称", menuDisabled: true},
			    {dataIndex : "paper_name",	header : "预印纸名称", menuDisabled: true}, 
			    {dataIndex : "start_time",	header : "开始时间",width:120, menuDisabled: true},
			    {dataIndex : "end_time",	header : "结束时间",width:120, menuDisabled: true},          
			    {dataIndex : "state",header:"状态", menuDisabled: true,
			       renderer:function(input){
	 				  if(""==input)return input;
	          		  var res2=state_store.getById(input);
					  return res2.data.text;
	           	   }
			    }
			],
			bbar : new Ext.ux.PagingToolbar( {
				pageSize : limit,
				store:p1_store
			}),
			tbar:["&nbsp&nbsp期别:",
			 {
				id: "a",
				xtype:"datefield",
				format:"Ymd",
				editable :false,
				value:"",
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp外包商:",
			{
				id: "b",
				xtype: "billCombox",
				displayField: "name",
				store: epiboly_store1,
				width:120,
				value:"",
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp卡产品:",
			{
				id: "c",
				xtype: "billCombox",
				valueField: "prodId",	
				displayField: "prodName",
				store: card_store,
				width:120,
				value:"",
				listeners: {
					"select": sel
				}
			},"&nbsp&nbsp状态:",
			{
				id: "d",
				xtype: "billCombox",
				value: "",
				store: state_store,
				width:120,
				listeners: {
					"select": sel
				}
			}]
		}]
	});
	p1_store.load({params:{start:0,limit:limit}});
	epiboly_store1.load({callback: function(){
		Ext.getCmp("b").setValue("");
	}});
	card_store.load({callback: function(){
		Ext.getCmp("c").setValue("");
	}});
	
	var CenterPanel=Ext.getCmp("CenterPanel");
	CenterPanel.removeAll();
	CenterPanel.add(xml_pel);
	CenterPanel.doLayout();
</script>